package domain;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Embeddable;
import javax.validation.constraints.Digits;
import javax.validation.constraints.Min;

import org.hibernate.validator.constraints.NotBlank;


@Embeddable
@Access(AccessType.PROPERTY)
public class Money {
	
	
	//Attributes//
		private Double amount;
		private String currency;
		
		@Digits(integer=12,fraction=2)
		@Min(0)
		public Double getAmount() {
			return amount;
		}
		
		public void setAmount(double amount) {
			this.amount = amount;
		}
		
		@NotBlank
		public String getCurrency() {
			return currency;
		}
		
		public void setCurrency(String currency) {
			this.currency = currency;
		}
		public String toString(){
			return getAmount().toString()+" "+getCurrency();
		}

}
